package com.dshome.cloudbean;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

import com.dshome.cloudbean.entity.LoginBean;
import com.dshome.cloudbean.network.MyApachHttp;
import com.dshome.cloudbean.uimanager.LoadingDialog;
import com.dshome.cloudbean.utils.JsonUtil;
import com.dshome.cloudbean.utils.PhoneUtil;

public class MainActivity extends Activity {
	final Handler mHandler = new Handler(){
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
//			mLoadingDialog.cancel();
		}
	};
	
	LoadingDialog mLoadingDialog ;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mLoadingDialog = new LoadingDialog(this);
		Log.i("test", "===========>>"+PhoneUtil.checkPhoneNumber("13311083078", "US"));
		TestLogin("13311083078", "", "111111");
	}

	private void TestLogin(String phone ,String email ,String password){
		final LoginBean mLoginBean = new LoginBean(phone, email, password);
		mLoadingDialog.show();
		new Thread(new Runnable() {
			@Override
			public void run() {
				String result = MyApachHttp.getHttpJson("http://mobile2.mybean.cn:9000/login", JsonUtil.creatJsonString(mLoginBean));
				Log.i("test", "result=====================>>"+result);
				mHandler.sendEmptyMessage(0);
			}
		}).start();
	}
	
//	private void TestRegister(String )
}
